
        <table class="form">
            <tbody>
                <?php if($hasmany):?>
                <tr> <th><a href="#cloner" id="clone_file">Adicionar mais um arquivo</a>
                                <span id="maxfile"></span></th></tr>
                <tr>
                <?php endif; ?>
                <table class="form">
                    <tbody id="add_file">
                        <tr>
                            <th>Arquivo</th>
                            <td>
                                <?php echo $form["midia"][0]['nm_midia']; ?>
                                Legenda: <?php echo $form["midia"][0]["ds_midia"]; ?>
                            </td>
                        </tr>
                    </tbody>
                </table>
                   <table id="cloner" class="form"></table>
                </tr>
            <tbody>
        </table>
        <?php if($hasmany):?>
        <script>
            $(function(){
                var i = 1;
                $("#clone_file").click(
                    function()
                    {
                        if(i < 10)
                                $("#add_file").append("<tr><th>Arquivo</th><td><input type='file' id='item_midia_nm_midia_"+i+"' name='item[midia]["+i+"][nm_midia]'>Legenda: <input type='text' id='item_midia_ds_midia_"+i+"' name='item[midia]["+i+"][ds_midia]'></td></tr>");
                        else
                                $("#maxfile").text("O número máximo de arquivos é 10");

                        i++;

                        //$("#add_file").clone().appendTo("#cloner");
                    }
                )
            });
        </script>
        <?php endif; ?>